﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ruandao.MiniAccess.Sqlite {
    public class ColumnSchema {
        /*
         * COLUMN_NAME  列名：
         * PRIMARY_KEY 是否为主键，true，false
         * DATA_TYPE 数据类型
         * CHARACTER_MAXIMUM_LENGTH
         * NUMERIC_PRECISION
         *  numeric_scale数值范围
         * COLLATION_NAME
         * UNIQUE是否唯一         *
         * TABLE_NAME 表名
         * COLUMN_DEFAULT 默认值
         * COLUMN_HASDEFAULT 是否有默认值 false，true
         * IS_NULLABLE 是否可以为NULL
         * 外键只能通过触发器
         * 
         */
        private string column_name;
        private Boolean isPrimaryKey;
        private string data_type;
        private int character_maximum_length;
        private int numeric_precision;
        private int numeric_scale;
        private string collation_name;
        private Boolean isUnique;
        private string table_name;
        private string column_default;
        private Boolean isColumnHasdefault;
        private Boolean isNullable;

        public ColumnSchema(string column_name, Boolean primary_key, string data_type, int character_maximum_length, Boolean is_nullable) {
            this.column_name = column_name;
            this.isPrimaryKey = primary_key;
            this.data_type = data_type;
            this.character_maximum_length = character_maximum_length;           
            this.isNullable = is_nullable;
        }

        public ColumnSchema(string column_name,Boolean primary_key,string data_type,int character_maximum_length,int numeric_precision,int numeric_scale,string collation_name,Boolean unique,string table_name,string column_default,Boolean column_hasdefault,Boolean is_nullable) 
        {
            this.column_name=column_name;
            this.isPrimaryKey=primary_key;
            this.data_type=data_type;
            this.character_maximum_length=character_maximum_length;
            this.numeric_precision=numeric_precision;
            this.numeric_scale=numeric_scale;
            this.collation_name=collation_name;
            this.isUnique=unique;
            this.table_name=table_name;
            this.column_default=column_default;
            this.isColumnHasdefault=column_hasdefault;
            this.isNullable=is_nullable;
        }

        public string ColumnName {
            get { return column_name; }
            set { column_name = value; }
        }
       

        public Boolean IsPrimaryKey {
            get { return isPrimaryKey; }
            set { isPrimaryKey = value; }
        }
       

        public string DataType {
            get { return data_type; }
            set { data_type = value; }
        }
        

        public int CharacterMaximumLength {
            get { return character_maximum_length; }
            set { character_maximum_length = value; }
        }
        

        public int NumericPrecision {
            get { return numeric_precision; }
            set { numeric_precision = value; }
        }
        

        public int NumericScale {
            get { return numeric_scale; }
            set { numeric_scale = value; }
        }
        
        public string CollationName {
            get { return collation_name; }
            set { collation_name = value; }
        }
        
        public Boolean IsUnique {
            get { return isUnique; }
            set { isUnique = value; }
        }
        
        public string TableName {
            get { return table_name; }
            set { table_name = value; }
        }
      
        public string ColumnDefault {
            get { return column_default; }
            set { column_default = value; }
        }
       
        public Boolean IsColumnHasdefault {
            get { return isColumnHasdefault; }
            set { isColumnHasdefault = value; }
        }
       

        public Boolean IsNullable {
            get { return isNullable; }
            set { isNullable = value; }
        }
    }
}
